package com.hc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hc.domain.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Set;
import java.util.SortedSet;

@Mapper
public interface PermissionMapper extends BaseMapper<Permission> {

    @Select("SELECT  tb_permission.* FROM  tb_permission  INNER JOIN  tb_role_permission  ON   tb_permission.id = tb_role_permission.permission_id  INNER JOIN  tb_role  ON   tb_role_permission.role_id = tb_role.id WHERE tb_permission.status = 1 and tb_role.id = #{id}")
    SortedSet<Permission> selectPermissionsByRoleId(Integer id);

}
